home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
033a
/
ttalm011.zip
/
ALMANAC.A86
< prev
next >
Wrap
Text File
|
1991-12-17
|
26KB
|
991 lines
;**************************************************
;Print out header and copyright notce
;**************************************************
START:
lea dx,crn
mov ah,9
int 021
jmp END_START
crn db 0d,0a,0a,0a,0a,0a
db ' ██████████████████████████████████████████████████ ',0d,0a
db ' █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█ ',0d,0a
db ' █▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓█ ',0d,0a
db ' █▓▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▓█ ',0d,0a
db ' █▓▒░ ░▒▓█ ',0d,0a
db ' █▓▒░ ALMANAC.COM ░▒▓█ ',0d,0a
db ' █▓▒░ ░▒▓█ ',0d,0a
db ' █▓▒░ Copyright 1991 Sam Watson ░▒▓█ ',0d,0a
db ' █▓▒░v01.1 ░▒▓█ ',0d,0a
db ' █▓▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▓█ ',0d,0a
db ' █▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓█ ',0d,0a
db ' █▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█ ',0d,0a
db ' ██████████████████████████████████████████████████ ',0d,0a
db 0d,0a,0a,'$'
;**************************************************
;End and exit to dos
;**************************************************
endit:
int 020
END_START:
;**************************************************
;retreive config information
;**************************************************
config_in:
lea dx,config_file ;Open the XXXXX.cfg file
mov ax,03d00
int 021
jnc >l1
lea bx,config_in ;Error detected es:bx has
mov es,cs ; retry address, ax has error
jmp disk_open_error ; code
l1: mov w handle,ax ;Save file handle
l2: mov bx,w handle ;Read ulist.cfg into memory
mov cx,1024
lea dx,config_info
mov ah,03f
int 021
jnc >l1
lea bx,l2 ;Error detected es:bx has
mov es,cs ; retry address, ax has error
jmp disk_read_error ; code
l1: mov bx,w handle ;Close the ulist.cfg file
mov ah,03e
int 021
jnc >l1
lea bx,l1 ;Error detected es:bx has
mov es,cs ; retry address, ax has error
jmp disk_close_error ; code
l1: lea bx,config_info ;Place 00 between data
mov si,bx ;Save address for backfill
mov ax,0
l2: cmp b[bx],0D ;Find Carrage Return
je fill_two_00
cmp b[bx],';' ;Find begin of comment
je fill_com_00
cmp b[bx],0 ;Find zeros
je back_fill
inc bx
jmp l2
fill_two_00:
mov w[bx],ax
add bx,2
jmp l2
fill_com_00:
l3: mov b[bx],al
inc bx
cmp b[bx],0d ;Find Carrage Return
jne l3
jmp fill_two_00
back_fill:
cmp si,bx ;Fill in spaces at end
jne >l1
jmp PLACE_CFG
l1: cmp w[bx],00020 ;Space & 00
jne >l3
l1: mov b[bx],al
dec bx
l2: jmp back_fill
l3: cmp w[bx],0009 ;Tab & 00
je l1
dec bx
jmp back_fill
config_file: db 'almanac.cfg',0
handle: dw 0
config_info: db 1024 dup(0)
;**************************************************
disk_open_error:
;**************************************************
push ax
lea dx,doemesg ;output message
mov ah,9
int 021
pop ax
jmp endit
doemesg: db 'There was an error opening a file$'
;**************************************************
disk_close_error:
;**************************************************
push ax
lea dx,dcemesg ;output message
mov ah,9
int 021
pop ax
jmp endit
dcemesg: db 'There was an error closeing a file$'
;**************************************************
disk_read_error:
;**************************************************
push ax
lea dx,dremesg ;output message
mov ah,9
int 021
pop ax
jmp endit
dremesg: db 'There was an error reading a file$'
;**************************************************
;Place configuration information into place
;**************************************************
PLACE_CFG:
lea bx,config_info ;Config information
mov si,cx,0 ;Address placement counter
lea di,bbs_path ;Find BBS Path name
call find_start
jnc >l1
jmp config_error
l1: push cx
call find_end
pop dx
jnc >l2
jmp config_error
l2: mov ax,cx
sub ax,dx
cmp ax,40
jbe >l1
jmp config_error
l1: lea di,out_file ;Find Output path
call find_start ; and file name
jnc >l1
jmp config_error
l1: push cx
call find_end
pop dx
jnc >l2
jmp config_error
l2: mov ax,cx
sub ax,dx
cmp ax,40
jbe >l1
jmp config_error
l1: lea di,sysop ;Find SYSOP name
call find_start
jnc >l1
jmp config_error
l1: push cx
call find_end
pop dx
jnc >l2
jmp config_error
l2: mov ax,cx
sub ax,dx
cmp ax,30
jbe >l1
jmp config_error
l1: lea di,bbs ;Find BBS name
call find_start
jnc >l1
jmp config_error
l1: push cx
call find_end
pop dx
jnc >l2
jmp config_error
l2: mov ax,cx
sub ax,dx
cmp ax,30
jbe >l1
jmp config_error
l1: lea di,phone ;Find BBS Phone number
call find_start
jnc >l1
jmp config_error
l1: push cx
call find_end
pop dx
jnc >l2
jmp config_error
l2: mov ax,cx
sub ax,dx
cmp ax,15
jbe place_info
jmp config_error
place_info:
lea di,line5 ;Place BBS name on
add di,2
lea si,bbs
cld
l1: cmp b[si],0
je >l2
movsb
jmp l1
l2: lea di,line5 ;Place phone number on
add di,62
lea si,phone
push si
dec si
l3: inc si
cmp b[si],0
jne l3
mov cx,si
pop si
sub cx,si
sub di,cx
cld
rep movsb
lea di,line6 ;Place sysop name
add di,8
lea si,sysop
cld
l1: cmp b[si],0
je >l2
movsb
jmp l1
l2: jmp END_CFG ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
bbs_path: db 56 dup(0)
sysop: db 31 dup(0)
bbs: db 31 dup (0)
phone: db 16 dup (0)
;*************************
find_start:
;*************************
clc
l1: cmp b[bx+si],0
jne >l2
inc si,cx
cmp cx,1024
jne l1
stc
l2: ret
;*************************
find_end:
;*************************
clc
l1: mov al,b[bx+si]
cmp al,0
je >l2
mov b[di],al
inc di,cx,si
cmp cx,1024
jne l1
stc
l2: ret
;*************************
config_error:
;*************************
lea dx,cfgerror
mov ah,9
int 021
int 020
cfgerror: db 0a,0a,0a,0d
db 'There is an error in XXXXX.CFG.',0a,0a,0a,0d,'$'
END_CFG:
;**************************************************
;Create output file
;**************************************************
create_out:
lea dx,out_file ;Create the output file
mov ah,03c
mov cx,00
int 021
jnc >l1
lea bx,create_out ;Error detected es:bx has
mov es,cs ; retry address, ax has error
jmp disk_create_error ; code
l1: jmp PLACE_H ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
;**************************************************
disk_create_error:
;**************************************************
push ax
lea dx,dcremesg ;output message
mov ah,9
int 021
pop ax
jmp endit
dcremesg: db 'There was an error creating a file$'
out_file: db 41 dup(0)
line1: db 0c
db '╔',62 dup('═'),'╗',0d,0a
line2: db '║ Ye Old BBS Almanac',24 dup(' '),'Todays Reflections ║',0d,0a
line3: db '╠',62 dup('═'),'╣',0d,0a
line5: db '║',62 dup(' '),'║',0d,0a
line6: db '║ SYSOP-',55 dup(' '),'║',0d,0a
line7: db '╚',62 dup('═'),'╝',0d,0a
;**************************************************
disk_write_error:
;**************************************************
push ax
lea dx,dwemesg ;output message
mov ah,9
int 021
pop ax
jmp endit
dwemesg: db 'There was an error writeing a file$'
;**************************************************
;open output file and place header in the file
;**************************************************
PLACE_H:
mov w handle,ax ;Save file handle
l1: mov bx,w handle
l2: lea dx,line1 ;Place header on out.txt
mov cx,397
call line_out
jnc END_CONFIG ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
lea bx,l2 ;Error detected es:bx has
mov es,cs ; retry address, ax has error
jmp disk_write_error ; code
line_out:
mov bx,w handle
mov ah,040
int 021
ret
END_CONFIG:
;**************************************************
get_date:
;Get the date off the system and build output
;**************************************************
mov ah,02a ;Get the system date
int 021
mov b weekday_num,al
mov b month_hex,dh
mov b day_hex,dl
mov w year_hex,cx
mov bx,w year_hex ;Convert year to decimal
call hex2bcd
mov w year_num,ax
mov bh,0
mov bl,b day_hex ;Convert day to decimal
call hex2bcd
mov b day_num,al
mov bl,b month_hex ;Convert month to decimal
call hex2bcd
mov b month_num,al
mov al,bl
dec al ;Convert month to ascii
lea si,month_table
l1: cmp al,0
je >l4
l2: cmp b[si],' ' ;Find SPACE
je >l3
inc si
jmp l2
l3: dec al
inc si
jmp l1
l4: lea di,month_ascii
cld
l1: lodsb
stosb
cmp al,' '
jne l1
lea si,weekday_table ;Convert week day to ascii
mov al,b weekday_num
mov cx,0a
mul cl
add si,ax
mov di,weekday_ascii
cld
rep movsb
jmp date_out
weekday_num: db 0
weekday_ascii: db 10 dup(20)
month_hex: db 0
month_num: db 0
month_ascii: db 10 dup(20)
day_hex: db 0
day_num: db 0
year_hex: dw 0
year_num: dw 0
weekday_table: db 'Sunday ','Monday ','Tuesday '
db 'Wednesday ','Thursday ','Friday '
db 'Saturday '
month_table: db 'January Feburary March April May June '
db 'July August September October November '
db 'December '
;**************************************************
hex2bcd:
;**************************************************
mov ax,0
mov cl,bh
cmp cl,027 ;Grater than 027FF hex is invalid
jna >l3
l1: mov ax,-1
l2: ret
l3: ror cl,1 ;4096 decimal equ digit
ror cl,1
ror cl,1
ror cl,1
and cl,0f
l4: jz >l5
add al,096
daa
xchg al,ah
adc al,040
daa
xchg al,ah
dec cl
jmp l4
l5: mov cl,bh ;256 decimal equ digit
and cl,0f
l6: jz >l7
add al,056
daa
xchg al,ah
adc al,2
daa
jc l1
xchg al,ah
dec cl
jmp l6
l7: mov cl,bl
ror cl,1 ;16 decimal equ digit
ror cl,1
ror cl,1
ror cl,1
and cl,0f
l8: jz >l9
add al,016
daa
xchg al,ah
adc al,0
daa
jc l1
xchg al,ah
dec cl
jmp l8
l9: mov cl,bl
and cl,0f ;unit equ digit
l5: je l2
add al,1
daa
xchg al,ah
adc al,0
daa
jc l1
xchg al,ah
dec cl
jmp l5
date_out:
;**************************************************
; Output line with date
;**************************************************
lea dx,dateline
mov di,dx
lea si,weekday_ascii ;Add day to line
mov cx,0a
cld
rep movsb
lea si,month_ascii ;Add month to line
l1: lodsb
stosb
cmp al,' ' ;Look for SPACE
je >l2
jmp l1
l2: mov al,b month_num ;Convert decimal to ascii
mov ah,al
mov cx,4
ror al,cl
and ax,0f0f
or ax,03030
mov w month_num_ascii,ax
mov al,b day_num ;Add day to line
mov ah,al
mov cx,4
ror al,cl
and ax,0f0f
or ax,03030
mov w date_ascii,ax
stosw
mov al,',' ;Add coma and space
mov ah,' '
stosw
mov al,b year_num[+1] ;Add first part of year
mov ah,al
mov cx,4
ror al,cl
and ax,0f0f
or ax,03030
stosw
mov al,b year_num ;Add second part of year
mov ah,al
mov cx,4
ror al,cl
and ax,0f0f
or ax,03030
stosw
mov cx,53
call line_out
jmp find_user
dateline: db 50 dup(' '),0d,0a,0a
bdayline: db 30 dup(' ')
wish: db " would like to wish it's users HAPPY BIRTHDAY!",0d,0a
;*************************
create_bday_line:
;*************************
l1: lea si,bbs ;Place BBS name on
lea di,bdayline
l2: lodsb
cmp al,0
je >l3
stosb
jmp l2
l3: lea si,wish
l4: movsb
cmp b[di-1],0a
jne l4
lea dx,bdayline
sub di,dx
mov cx,di
call line_out
ret
;**************************************************
find_user:
;**************************************************
lea si,bbs_path ;Open users file
lea di,users_file
l1: lodsb
cmp al,0
je >l2
stosb
jmp l1
l2: lea si,us
mov cx,15
rep movsb
lea dx,users_file
mov ax,03d00
int 021
jnc >l1
lea bx,find_user
mov es,cs
jmp disk_open_error
l1: jmp useropenok
user_handle: dw 0
userdat: db 164 dup(0)
userflg: db 0
month_num_ascii: dw 0
date_ascii dw 0
useropenok:
mov w user_handle,ax
l1: mov bx,w user_handle ;Read user file record
mov cx,163
lea dx,userdat
mov ah,03f
int 021
jnc >l2
lea bx,l1
mov es,cs
jmp disk_read_error
l2: cmp ax,0
jne >l9
jmp user_done
l9: lea bx,userdat
mov ax,w[bx+91] ;Check for birth month
cmp ax,w month_num_ascii
jne l1 ;No match on month
mov ax,w[bx+94] ;Check for birth date
cmp ax,w date_ascii
jne l1 ;No match on date
cmp b userflg,0
jne birth_match
call create_bday_line
inc b userflg
birth_match:
mov al,' ' ;Clear out old info
mov cx,75
lea di,name_line
rep stosb
lea di,name_line
add di,5
lea si,userdat
mov cx,32
l3: lodsb ;Name
cmp al,0
je >l4
dec cx
je >l4
stosb
jmp l3
l4: mov al,' '
stosb
mov ax,'fo'
stosw
mov al,' '
stosb
mov cx,32
lea si,userdat ;City/state
add si,47
l5: lodsb
cmp al,0
je >l6
dec cx
je >l6
stosb
jmp l5
l6: lea dx,name_line
mov cx,77
call line_out
jmp l1
name_line: db 75 dup(" "),0d,0a
user_done:
mov bx,w user_handle ;Close user file record
mov ah,03e
int 021
jnc event
lea bx,user_done
mov es,cs
jmp disk_close_error
users_file: db 56 dup(0)
us: db '\work\users.dat'
;**************************************************
event:
;**************************************************
lea dx,alm_eve ;Open almanac events
mov ax,03d00
int 021
jnc event_open
lea bx,event
mov es,cs
jmp disk_open_error
event_open:
mov w alm_hand,ax
mov cx,4096
mov dx,alm_data
call alma_read
mov w alm_char_e,ax ;number of characters read
call match
if nc jmp birth ;If no events found
more_eve:
call moveup
call match_cont
if c jmp more_eve
call almclose ;Close the event list
eventout: ;Output event data
lea dx,evehead ;Header
mov cx,157
call line_out
lea dx,alm_data ;Output events
mov cx,w alm_char_b
call line_out
jmp birth
evehead: db 0a,'**************************************************',0d,0a
db '* On This Day in History *',0d,0a
db '**************************************************',0d,0a
;**************************************************
birth:
;**************************************************
mov w alm_char_b,0
mov w alm_char_e,0
lea dx,alm_bir ;Open almanac births
mov ax,03d00
int 021
jnc birth_open
jmp disk_open_error
birth_open:
mov w alm_hand,ax
mov cx,4096
mov dx,alm_data
call alma_read
mov w alm_char_e,ax ;number of characters read
call match
if nc jmp reminder ;If no births found
more_bir:
call moveup
call match_cont
if c jmp more_bir
call almclose ;Close the birth list
birthout: ;Output birth data
lea dx,birhead ;Header
mov cx,157
call line_out
lea dx,alm_data ;Output events
mov cx,w alm_char_b
call line_out
jmp reminder
birhead: db 0a,'**************************************************',0d,0a
db '* Who was born today *',0d,0a
db '**************************************************',0d,0a
;**************************************************
reminder:
;**************************************************
mov w alm_char_b,0
mov w alm_char_e,0
lea dx,alm_rem ;Open almanac reminders
mov ax,03d00
int 021
jnc rem_open
jmp disk_open_error
rem_open:
mov w alm_hand,ax
mov cx,4096
mov dx,alm_data
call alma_read
mov w alm_char_e,ax ;number of characters read
rem_redo:
call match
if nc jmp quote ;If no reminders found
push ax
mov al,b[si+bx+2]
cmp al,' ' ;Ok if blank
if e jmp more_rem
and al,0f ;Strip bias
cmp al,b weekday_num
if ne jmp lx1
mov b[si+bx+2],' '
jmp more_rem
lx1: pop ax
jmp rem_redo
more_rem:
pop ax
call moveup
more_rem2:
call match_cont
if nc jmp remclose
push ax
mov al,b[si+bx+2]
cmp al,' ' ;Ok if blank
if e jmp more_rem
and al,0f ;Strip off bias
cmp al,b weekday_num
if ne jmp lx2
mov b[si+bx+2],' '
jmp more_rem
lx2: pop ax
jmp more_rem2
remclose:
call almclose ;Close the reminder list
reminderout: ;Output reminder data
lea dx,remhead ;Header
mov cx,157
call line_out
lea dx,alm_data ;Output reminders
mov cx,w alm_char_b
call line_out
jmp quote
remhead: db 0a,'**************************************************',0d,0a
db '* Todays reminders *',0d,0a
db '**************************************************',0d,0a
moveup:
push cx,bx,si,ax
add si,bx
add si,2 ;Start of info after date
lea di,alm_data
add di,w alm_char_b ;Placement of info
l1: lodsb
stosb
dec cx
if z jmp sp_more_data
inc w alm_char_b
cmp al,0a ;End
jne l1
pop ax,si,bx,cx
ret
sp_more_data:
pop ax,si,bx,cx
dec w alm_char_b
call more_data
sub bx,2
jmp moveup
match: ;Find match for date
mov cx,w alm_char_e ;Number of characters in buffer
lea si,alm_data
mov bx,w alm_char_b ;Number of char held
match_cont:
mov ax,w month_num_ascii
l1: cmp w[si+bx],ax ;Find month match
je mon_match
l5: inc bx ;Go to next LF
dec cx
if z call more_data
l2: inc bx
dec cx
if z call more_data
cmp w alm_char_e,0
if z jmp >l6
cmp b[si+bx],0a
jne l2
inc bx
dec cx
if z call more_data
cmp w alm_char_e,0
if z jmp >l6
mov ax,w month_num_ascii
jmp l1
mon_match:
inc bx,bx ;Month match
dec cx,cx
if z call more_data
cmp w alm_char_e,0
if z jmp >l6
mov ax,date_ascii
l4: cmp w[si+bx],ax ;Find date match
if nz jmp l5
stc
ret ;Match found return
l6: clc ;No match retrun
ret
more_data:
push ax
mov cx,4096 ;Buffer size
if c sub cx,2 ;If cary keep month
sub cx,w alm_char_b ;Subtract out number in
lea dx,alm_data
add dx,4096
sub dx,cx
call alma_read
mov w alm_char_e,cx,ax ;Number of characters read
lea si,alm_data
mov bx,w alm_char_b
pop ax
ret
alma_read: ;Read ALMANC.xxx file
mov bx,w alm_hand
mov ah,03f
int 021
jnc >l1
jmp disk_read_error
l1: ret
almclose: ;Close ALMANC.xxx file
mov bx,w alm_hand
mov ah,03e
int 021
if nc ret
jmp disk_close_error
alm_bir: db 'almanac.bir',0
alm_eve: db 'almanac.eve',0
alm_rem: db 'almanac.rem',0
alm_quo: db 'almanac.quo',0
alm_hand: dw 0
alm_char_b: dw 0
alm_char_e: dw 0
alm_data: db 4096 dup(?)
;**************************************************
quote:
;**************************************************
lea dx,nam ;Open file and get numbers
mov ax,03d00
int 021
jnc >l1
jmp disk_open_error
l1: mov w hhd,ax ;Read
mov bx,ax
mov dx,offset anum
mov cx,4
mov ah,03f
int 021
mov bx,w hhd ;Close
mov ah,03e
int 021
mov dx,offset nam ;Delete file
mov ah,041
int 021
inc w anum
mov bx,offset anum
mov ax,w[bx]
cmp ax,w[bx+2]
if e mov w anum,0
mov ah,03c ;Open file to reset numbers
mov dx,offset nam
mov cx,0
int 021
mov bx,ax ;Write
mov ah,040
mov cx,4
mov dx,offset anum
int 021
mov ah,03e ;Close
int 021
start_quote:
lea dx,alm_quo ;Open file for quotes
mov ax,03d00
int 021
if c jmp disk_open_error
quo_open:
mov w alm_hand,ax
quo_rd: ;Read Quote data
mov cx,4096
lea dx,alm_data
call alma_read
mov di,ax
mov cx,w anum
inc cx
lea si,alm_data
l1: dec cx ;Go to correct al
if e jmp qo_st
l2: dec di
if nz jmp >l3
push cx
mov cx,4096 ;Get more data
lea dx,alm_data
call alma_read
mov di,ax
lea si,alm_data
pop cx
l3: inc si
cmp b[si],0a
if ne jmp l2
inc si
jmp l1
qo_st:
mov cx,3
lea dx,lf
call line_out
mov cx,0
push si
l1: inc si,cx
cmp b[si],0a
if e jmp >l2
cmp cx,40
if b jmp l1
cmp b[si],' '
if ne jmp l1
pop dx
add dx,cx
push dx
sub dx,cx
call line_out
mov cx,2
lea dx,lf
call line_out
mov cx,0
jmp l1
l2: pop dx
call line_out
quo_clo: ;Close quote
call almclose
jmp final
anum: db 0,0,0,0
nam: db 'number.hex',0
hhd: dw 0
lf: db 0d,0a,0a
final:
mov bx,w handle ;Place tag to follow listing
lea dx,tag
mov cx,113
mov ah,040
int 021
mov bx,w handle
mov ah,03e
int 021
if nc jmp endit
call disk_close_error
tag: db 0d,0a,0a,'ALMANAC.COM v01.1 written for TRITEL BBS '
db 'systems',0d,0a,'Copyright 1991 Sam Watson '
db '(MY HOUSE BBS <708>739-9355)',0d,0a,0a,16